Skip to content

Conversation

@hieblmi
Copy link
Collaborator

@hieblmi hieblmi commented May 8, 2025

This PR introduces a openchannel subcommand to static addresses.

It provides the same experience as lncli openchannel.
Exmples:

Open a channel with all available deposits:

loop static openchannel --fundmax --sat_per_vbyte XXX --private ...

Open a channel with specified local funding amount, coin-selected from available deposits under fee and dust considerations.

loop static openchannel --local_amt XXX --sat_per_vbyte YYY --private ...

Open a channel from two deposits AAA and BBB while taking their combined value(fundmax) as funding amount and considering fees and dust limit.

loop static openchannel --utxo AAA --utxo BBB --fundmax --sat_per_vbyte YYY --private ...

Open a channel from two deposits AAA and BBB while taking a specified amount(local_amt) as funding amount and considering fees and dust limit.

loop static openchannel --utxo AAA --utxo BBB --local_amt --sat_per_vbyte YYY --private ...

TODOs:

  • Integration tests

@hieblmi hieblmi self-assigned this May 8, 2025
@hieblmi hieblmi marked this pull request as draft May 8, 2025 20:31
@hieblmi hieblmi force-pushed the static-open-channel branch 2 times, most recently from 60286d0 to 97049c1 Compare May 9, 2025 09:20
@hieblmi hieblmi force-pushed the static-open-channel branch 6 times, most recently from 6c330e5 to 4184f2d Compare May 21, 2025 12:19
@hieblmi hieblmi changed the title [WIP] staticaddr: channel funding with deposits staticaddr: channel funding with deposits May 21, 2025
@hieblmi hieblmi marked this pull request as ready for review May 21, 2025 12:22
@hieblmi hieblmi force-pushed the static-open-channel branch 4 times, most recently from fbe14d2 to 59975f0 Compare May 28, 2025 09:57
@hieblmi
Copy link
Collaborator Author

hieblmi commented May 28, 2025

Rebased

@hieblmi hieblmi force-pushed the static-open-channel branch from 59975f0 to 596b1df Compare June 30, 2025 14:57
@hieblmi
Copy link
Collaborator Author

hieblmi commented Jun 30, 2025

Rebased

@hieblmi hieblmi force-pushed the static-open-channel branch from 596b1df to 4d0e787 Compare July 2, 2025 17:01
@hieblmi
Copy link
Collaborator Author

hieblmi commented Jul 2, 2025

Rebased master

@hieblmi hieblmi force-pushed the static-open-channel branch from 4d0e787 to 818b915 Compare July 17, 2025 13:37
@hieblmi
Copy link
Collaborator Author

hieblmi commented Jul 17, 2025

Rebased master.

@hieblmi hieblmi force-pushed the static-open-channel branch from 818b915 to c4dc989 Compare October 7, 2025 12:27
@hieblmi hieblmi force-pushed the static-open-channel branch 2 times, most recently from bf7bd29 to 7bd2fd0 Compare October 20, 2025 10:44
@hieblmi
Copy link
Collaborator Author

hieblmi commented Oct 20, 2025

Rebased with latest master

Copy link
Collaborator

@starius starius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Started reviewing the PR.
I propose to dedup channel open related proto types with LND, see hieblmi#2

@@ -0,0 +1,134 @@
package staticutil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-ascii characters in the commit message. I think we can remove it.

)

// ToPrevOuts converts a slice of deposits to a map of outpoints to TxOuts.
func ToPrevOuts(deposits []*deposit.Deposit,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to cover the function with unit tests.

)
}

func (m *Manager) toPrevOuts(deposits []*deposit.Deposit,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this method reuse staticutil.ToPrevOuts?

Also we have loopin.StaticAddressLoopIn.toPrevOuts method. I guess it should also reuse staticutil.ToPrevOuts, right?

signer lndclient.SignerClient, deposits []*deposit.Deposit,
addrParams *address.Parameters,
staticAddress *script.StaticAddress) ([]*input.MuSig2SessionInfo,
[][]byte, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to cover the function with unit tests.

}

// CreateMusig2Sessions creates a musig2 session for a number of deposits.
func CreateMusig2Sessions(ctx context.Context,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reuse this function in loopin.StaticAddressLoopIn.createMusig2Sessions?

returns (StaticAddressSummaryResponse);

/* loop:`static`
/* loop:`in`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe static in?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIxed in hieblmi#2

rpc StaticAddressLoopIn (StaticAddressLoopInRequest)
returns (StaticAddressLoopInResponse);

/* loop:`openchannel`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static openchannel?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in hieblmi#2

Comment on lines +218 to +221
/*
An optional error string.
*/
string error = 2;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we deliver errors via gRPC errors?

uint64 asset_cost_offchain = 3;
}

message OpenChannelRequest {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL at hieblmi#2
I removed all the code below this line from this file and used the original LND types from lntypes.

@hieblmi hieblmi force-pushed the static-open-channel branch from a0fe637 to 706c1ff Compare October 27, 2025 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants